#include "fig_boss_boffer.h"
#include "fighter.h"
#include "fig_bullet.h"
#include "fig_enemybullet_master.h"
#include "fig_player_craft.h"
#include "fig_sounds.h"

#include "num/rand.h"
#include "math/facing.h"
#include "dd/dd_man.h"

FIGBossBoffer::FIGBossBoffer(FIGEnemyCraft::ENEMY_TYPES EnemyType) : 
								FIGEnemyBoss(											
											EnemyType
											)
								
{
	m_ShootCounter.SetLimit(5.0f);	
	m_SecondaryWeaponCounter.SetLimit(2.0f);
}

void		FIGBossBoffer::OnShootStyle1()
{
	bool DegreeRight = true;
	float Degree = 180.0f;
	float Degree2 = 180.0f;

	for(int i = 0; i < 40; i++)
	{
		FIGEnemyBulletMaster::Instance().Shoot(
											this,
											m_Bone.GetPosByWayPoint(8),
											FIGEnemyBulletMaster::BULLET_TYPE_LONG_RED,
											FIGBullet::SHOOT_STYLES_SINGLE,
											Degree ,		// degree
											0.1f * i,
											false,
											NULL,
											false,
											FIGSounds::BOSS_SHOOT
          									);

		FIGEnemyBulletMaster::Instance().Shoot(
											this,
											m_Bone.GetPosByWayPoint(10),
											FIGEnemyBulletMaster::BULLET_TYPE_LONG_YELLOW,
											FIGBullet::SHOOT_STYLES_SINGLE,
											Degree2 ,		// degree
											0.1f * i,
											false,
											NULL,
											false,
											FIGSounds::BOSS_SHOOT
          									);

		if( DegreeRight )
		{
			Degree += 2.0f;
			Degree2 -= 2.0f;
			if( Degree > 180.0f + 10.0f)
				DegreeRight = false;

		}
		else if(!DegreeRight)
		{
			Degree -= 2.0f;
			Degree2 += 2.0f;
			if( Degree < 180.0f - 10.0f)
				DegreeRight = true;
		}
		

	}

	

}

void		FIGBossBoffer::OnShootStyle2()
{
	bool DegreeRight = true;
	float Degree = 180.0f;
	float Degree2 = 180.0f;

	
	for(int i = 0; i < 40; i++)
	{
		FIGEnemyBulletMaster::Instance().Shoot(
											this,
											m_Bone.GetPosByWayPoint(9),
											FIGEnemyBulletMaster::BULLET_TYPE_LONG_RED,
											FIGBullet::SHOOT_STYLES_SINGLE,
											Degree ,		// degree
											0.1f * i,
											false,
											NULL,
											false,
											FIGSounds::BOSS_SHOOT
          									);

		FIGEnemyBulletMaster::Instance().Shoot(
											this,
											m_Bone.GetPosByWayPoint(11),
											FIGEnemyBulletMaster::BULLET_TYPE_LONG_YELLOW,
											FIGBullet::SHOOT_STYLES_SINGLE,
											Degree2 ,		// degree
											0.1f * i,
											false,
											NULL,
											false,
											FIGSounds::BOSS_SHOOT
          									);

		if( DegreeRight )
		{
			Degree += 2.0f;
			Degree2 -= 2.0f;
			if( Degree > 180.0f + 10.0f)
				DegreeRight = false;

		}
		else if(!DegreeRight)
		{
			Degree -= 2.0f;
			Degree2 += 2.0f;
			if( Degree < 180.0f - 10.0f)
				DegreeRight = true;
		}
		

	}

}


void		FIGBossBoffer::OnShootStyle3()
{
	float ShootExtraDegree = 0;
	for(int j = 0; j < 6; j++)
	{
		for(int i = 0; i < 4; i++)
		{
		
			FIGEnemyBulletMaster::Instance().Shoot(
												this,
												m_Bone.GetPosByWayPoint(i),
												FIGEnemyBulletMaster::BULLET_TYPE_LONG_RED,
												FIGBullet::SHOOT_STYLES_SINGLE,
												180,		// degree
												j * 0.5f,
												false,
												NULL,
												false,
												FIGSounds::BOSS_SHOOT
          										);
		}
	}
	for(int j = 0; j < 5; j++)
	{
		for(int i = 4; i < 14; i++)
		{
			if( i % 2 == 0)
				ShootExtraDegree = -3;
			else
				ShootExtraDegree = +3;

			FIGEnemyBulletMaster::Instance().Shoot(
												this,
												m_Bone.GetPosByWayPoint(i),
												FIGEnemyBulletMaster::BULLET_TYPE_CIRCLE_TRIPPLELAYER,
												FIGBullet::SHOOT_STYLES_SINGLE,
												ShootExtraDegree + 180,		// degree
												j * 0.5f,
												false,
												NULL,
												false,
												FIGSounds::BOSS_SHOOT
          										);
		}

		FIGEnemyBulletMaster::Instance().Shoot(
												this,
												m_Bone.GetPosByWayPoint(14),
												FIGEnemyBulletMaster::BULLET_TYPE_CIRCLE_TRIPPLELAYER,
												FIGBullet::SHOOT_STYLES_SINGLE,
												90,		// degree
												j * 0.5f,
												false,
												NULL,
												false,
												FIGSounds::BOSS_SHOOT
          										);

		FIGEnemyBulletMaster::Instance().Shoot(
												this,
												m_Bone.GetPosByWayPoint(16),
												FIGEnemyBulletMaster::BULLET_TYPE_CIRCLE_TRIPPLELAYER,
												FIGBullet::SHOOT_STYLES_SINGLE,
												90,		// degree
												j * 0.5f,
												false,
												NULL,
												false,
												FIGSounds::BOSS_SHOOT
          										);

		FIGEnemyBulletMaster::Instance().Shoot(
												this,
												m_Bone.GetPosByWayPoint(15),
												FIGEnemyBulletMaster::BULLET_TYPE_CIRCLE_TRIPPLELAYER,
												FIGBullet::SHOOT_STYLES_SINGLE,
												-90,		// degree
												j * 0.5f,
												false,
												NULL,
												false,
												FIGSounds::BOSS_SHOOT
          										);

		FIGEnemyBulletMaster::Instance().Shoot(
												this,
												m_Bone.GetPosByWayPoint(17),
												FIGEnemyBulletMaster::BULLET_TYPE_CIRCLE_TRIPPLELAYER,
												FIGBullet::SHOOT_STYLES_SINGLE,
												-90,		// degree
												j * 0.5f,
												false,
												NULL,
												false,
												FIGSounds::BOSS_SHOOT
          										);
	}
}


void		FIGBossBoffer::OnShootStyle4()
{
	for(int j = 0; j < 8; j++)
	{
		for(int i = 0; i < 4; i++)
		{
			FIGEnemyBulletMaster::Instance().Shoot(
												this,
												m_Bone.GetPosByWayPoint(i),
												FIGEnemyBulletMaster::BULLET_TYPE_LONG_RED,
												FIGBullet::SHOOT_STYLES_SINGLE,
												180,		// degree
												j * 0.5f,
												true,
												NULL,
												false,
												FIGSounds::BOSS_SHOOT	
          										);
		}
	}
}


void		FIGBossBoffer::OnSecondaryWeaponShoot()
{
	FIGEnemyBulletMaster::Instance().Shoot(
											this,
											m_Bone.GetPosByWayPoint(14),
											FIGEnemyBulletMaster::BULLET_TYPE_CIRCLE_GLOW,
											FIGBullet::SHOOT_STYLES_TRIPPLE,
											90,		// degree
											0,
											false,
											NULL,
											false,
											FIGSounds::BOSS_SHOOT
          									);

	FIGEnemyBulletMaster::Instance().Shoot(
											this,
											m_Bone.GetPosByWayPoint(15),
											FIGEnemyBulletMaster::BULLET_TYPE_CIRCLE_GLOW,
											FIGBullet::SHOOT_STYLES_TRIPPLE,
											-90,		// degree
											0,
											false,
											NULL,
											false,
											FIGSounds::BOSS_SHOOT
          									);
}







	